<?php
/* Helper function */
if (!function_exists('no_wpautop')) {
function no_wpautop($content) 
{ 
        $content = do_shortcode( shortcode_unautop($content) ); 
        $content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content );
        return $content;
}
}

/* Counter shortcode */

if (!function_exists('counter')) {
function counter($atts, $content = null) {
		extract(shortcode_atts(array("type" => "", "position" => "", "delay" => "", "digit" => "", "font_size" => "", "font_color" => ""), $atts));
    $html = "";  
		$html .=  '<div class="counter_holder '.$position.'"';
		if($font_size || $font_color){
			$html .= 'style="color:'.$font_color.'; font-size:'.$font_size.'px;"';
		}
		$html .= '><span class="counter '.$type.'" data-delay="'.$delay.'"';
		if($font_size || $font_color){
			$html .= 'style="height:'.$font_size.'px; line-height:'.$font_size.'px;"';
		}
		$html .= '>'.$digit.'</span>'.no_wpautop($content).'</div>';

    return $html;
}
}
add_shortcode('counter', 'counter');

